/*
 * The MiniQt Library
 *
 * Copyright (C) 1999 Sandro Sigala <ssigala@globalnet.it>
 */

#ifndef QWIDGET_H
#define QWIDGET_H

#include "qwindowdefs.h"
#include "qobject.h"
#include "qstring.h"
#include "qevent.h"

struct QWidgetPrivate;

class QWidget : public QObject {
public:
	QWidget(QWidget *parent = 0, const char *name = 0, WFlags f = 0);
	~QWidget();

	WId winId();
	void setWinId(WId id);
	static QWidget *find(WId id);

	QWidget *parentWidget() const;
	bool isTopLevel() const;
	bool isWidgetType() const;
	bool isVisible() const;

	virtual void setCaption(const QString& caption);
	virtual const QString& caption() const;

	virtual void move(int x, int y);
	virtual void resize(int width, int height);
	virtual void setGeometry(int x, int y, int width, int height);

	virtual void show();
	virtual void hide();
	virtual bool close();

	virtual void event(QEvent *e);

	void movedTo(int x, int y);
	void resizedTo(int width, int height);

protected:
	void registerWinId(WId id, QWidget *w);

	virtual void mousePressEvent(QMouseEvent *e);
	virtual void mouseReleaseEvent(QMouseEvent *e);

private:
	QWidgetPrivate *d;

	void unregisterWinId(WId id);
};

#endif // !QWIDGET_H
